package com.lehecai.core.game;

import com.lehecai.core.IntegerBeanLabelItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * 游戏组别
 * @author He Wang
 */
public class GameFeature extends IntegerBeanLabelItem {

	private static final long serialVersionUID = 7009455804239792650L;
	private static final Logger logger = LoggerFactory.getLogger(GameFeature.class.getName());
	
	private static List<GameFeature> items = new ArrayList<GameFeature>();
	private static List<GameFeature> queryItems = new ArrayList<GameFeature>();
	
	protected GameFeature(String name, int value) {
		this(name, value, false);
	}
	
	protected GameFeature(String name, int value, boolean queryOnly) {
		super(GameFeature.class.getName(), name, value);
		queryItems.add(this);
		if (!queryOnly) {
			items.add(this);
		}
	}
	
	public static GameFeature getItem(int value){
		try {
			return (GameFeature)GameFeature.getResult(GameFeature.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<GameFeature> getItems() {
		return items;
	}
	
	public static List<GameFeature> getQueryItems() {
		return queryItems;
	}

	public static final GameFeature ALL = new GameFeature("全部", -1, true);
	public static final GameFeature GAME_FEATURE_NULL = new GameFeature("无", 1);
	public static final GameFeature GAME_FEATURE_KONGFU = new GameFeature("武侠", 2);
	public static final GameFeature GAME_FEATURE_LEGENDARY = new GameFeature("神话", 3);
	public static final GameFeature GAME_FEATURE_HISTORY = new GameFeature("历史", 4);
	public static final GameFeature GAME_FEATURE_MODERN = new GameFeature("现代", 5);
	public static final GameFeature GAME_FEATURE_ILLUSION = new GameFeature("魔幻", 6);
	public static final GameFeature GAME_FEATURE_FANTASY = new GameFeature("奇幻", 7);
	public static final GameFeature GAME_FEATURE_SCIENCE = new GameFeature("科幻", 8);
	public static final GameFeature GAME_FEATURE_INK = new GameFeature("水墨", 9);
	public static final GameFeature GAME_FEATURE_REALITY = new GameFeature("写实", 10);
	public static final GameFeature GAME_FEATURE_CUTE = new GameFeature("Q版", 11);
	public static final GameFeature GAME_FEATURE_ART = new GameFeature("唯美", 12);
	public static final GameFeature GAME_FEATURE_HUMOUR = new GameFeature("搞怪", 13);
}
